<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class StoreHeadGoods extends Model
{
    use HasFactory;
    protected $table = "store_head_goods";
    protected $guarded = [];

    /**
     * 团长商品添加
     * @param $arr
     * @return mixed
     */
    public static function addHeadGoods($arr){
        return self::create($arr);
    }
    /**
     * zyy
     * @param $hid
     * @return mixed
     * 查询用户
     */
    public static function groupData($hid){
        return self::where("hid",$hid)->get();
    }

    /**
     * zyy
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * 查询团长限卖商品
     */
    public function groupCidData(){
        return $this->belongsTo(StoreProduct::class,"cid","id");
    }
}
